<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script type="text/javascript" src="/${initParam.context_root }/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/${initParam.context_root }/jquery-ui-1.8.21.custom.min.js"></script>
<link type="text/css" href="/${initParam.context_root }/css/smoothness/jquery-ui-1.8.21.custom.css" rel="stylesheet"></link>

<h2>상품 리스트</h2>
<p>
<table border=2 width=900px>
<tr>
		<th rowspan="2" width="5%" bgcolor="lightgray">순번</th>
		<th rowspan="2" width="5%" bgcolor="lightgray">지역</th>
		<th rowspan="2" width="13%" bgcolor="lightgray">이미지</th>
		<th bgcolor="lightgray">구매사이트명</th>
		<th bgcolor="lightgray">상품가격</th>
		<th rowspan="2" width="7%" bgcolor="lightgray">재고량</th>
		<th rowspan="2" width="10%" bgcolor="lightgray">등록일</th>
		<th rowspan="2" width="20%" bgcolor="lightgray">상세</th>
		<th rowspan="2" bgcolor="lightgray">선택</th>
	</tr>
	<tr>
		<th width="15%" bgcolor="lightgray">상품명</th>
		<th width="10%" bgcolor="lightgray">쿠폰가격</th>
	</tr>
	<c:choose>
	<c:when test="${empty requestScope.productList }">
		<tr>
		<td colspan="9"> <font color=red><b>찾는 조건에 맞는 결과가 없습니다.</b></font>
		</td>
		</tr>
	</c:when>
	<c:when test="${not empty requestScope.productList  }">
	<c:forEach items="${requestScope.productList }" var="productDTO" varStatus="i">
		<tr>
			<td rowspan="2">${i.count }</td>
			<td rowspan="2" >${productDTO.saleLocation }</td>
			<td rowspan="2" >
				<c:if test="${not empty productDTO.productImageFilename }">
					<img src="/${initParam.context_root }/upfile/${productDTO.productImageFilename }" width="80" height="50">
				</c:if>
			</td>
			<td >${productDTO.companyId }</td>
			<td><strike>${productDTO.originalPrice }</strike>원</td>
			<td rowspan="2" >${productDTO.stockEA }개</td>
			<td rowspan="2" >${productDTO.registerDate }</td>
			<td rowspan="2" >${productDTO.content }</td>
			<td rowspan="2"><input type="button" value="선택" onclick="location.href='/${initParam.context_root }/searchProductInput.do?productId=${productDTO.productId}'"></td>
		</tr>
		<tr>
			<td >${productDTO.productName }</td>
			<td >${productDTO.reducedPrice } 원</td>
		</tr>
	</c:forEach>
	</c:when>
	<c:otherwise>
		<tr>
		<td colspan="8"> 로그인을 먼저 해주세요. 
		</td>
		</tr>
	</c:otherwise>
	</c:choose>
</table>

<p>
